<html>
<head><meta charset="utf-8"><title>Design for testability · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Design.20for.20testability.html">Design for testability</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="215223020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Design%20for%20testability/near/215223020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alastair Reid <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Design.20for.20testability.html#215223020">(Nov 01 2020 at 02:41)</a>:</h4>
<p>How should we structure Rust code to make it easy to test?<br>
I wrote a survey of everything I could find on the topic.<br>
Please tell me what I missed.<br>
<a href="https://alastairreid.github.io/rust-testability/">https://alastairreid.github.io/rust-testability/</a></p>



<a name="215223143"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Design%20for%20testability/near/215223143" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mark Drobnak <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Design.20for.20testability.html#215223143">(Nov 01 2020 at 02:45)</a>:</h4>
<p>If I may plug my own crate...<br>
<a href="http://github.com/Mcat12/shaku">Shaku</a> would fit in your section on dependency injection. It's a compile-time dependency injection library, designed to have an ergonomic API.</p>



<a name="215223194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Design%20for%20testability/near/215223194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mark Drobnak <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Design.20for.20testability.html#215223194">(Nov 01 2020 at 02:46)</a>:</h4>
<p>It works well when combined with a mocking library like <code>mockall</code></p>



<a name="215223265"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Design%20for%20testability/near/215223265" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mark Drobnak <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Design.20for.20testability.html#215223265">(Nov 01 2020 at 02:48)</a>:</h4>
<p><a href="https://github.com/dtolnay/trybuild"><code>trybuild</code></a> is another great library by dtolnay for testing compile time error messages, such as from proc macros.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>